home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume7 / xdm / patch1.02 < prev    next >
Encoding:
Internet Message Format  |  1990-06-08  |  19.8 KB

  1. Path: uunet!cs.utexas.edu!texbell!texsun!newstop!sun!ultima.cs.uts.oz.au
  2. From: keane@ultima.cs.uts.oz.au (Chris Keane)
  3. Newsgroups: comp.sources.x
  4. Subject: v07i087: xdm, Patch1, Part02/02
  5. Message-ID: <136911@sun.Eng.Sun.COM>
  6. Date: 8 Jun 90 17:41:15 GMT
  7. Sender: news@sun.Eng.Sun.COM
  8. Lines: 668
  9. Approved: argv@sun.com
  10.  
  11. Submitted-by: keane@ultima.cs.uts.oz.au (Chris Keane)
  12. Posting-number: Volume 7, Issue 87
  13. Archive-name: xdm/patch1.02
  14. Patch-To: xdm: Volume XXX, Issue XXX
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then unpack
  18. # it by saving it into a file and typing "sh file".  To overwrite existing
  19. # files, type "sh file -c".  You can also feed this as standard input via
  20. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  21. # will see the following message at the end:
  22. #        "End of shell archive."
  23. # Contents:  ptyx.h xroutines.c
  24. # Wrapped by keane@zeus on Fri Jun  8 16:34:39 1990
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test -f 'ptyx.h' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'ptyx.h'\"
  28. else
  29. echo shar: Extracting \"'ptyx.h'\" \(15008 characters\)
  30. sed "s/^X//" >'ptyx.h' <<'END_OF_FILE'
  31. X/*
  32. X *    $XConsortium: ptyx.h,v 1.18 88/10/07 14:12:29 swick Exp $
  33. X */
  34. X
  35. X#include <X11/copyright.h>
  36. X
  37. X/*
  38. X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  39. X *
  40. X *                         All Rights Reserved
  41. X *
  42. X * Permission to use, copy, modify, and distribute this software and its
  43. X * documentation for any purpose and without fee is hereby granted,
  44. X * provided that the above copyright notice appear in all copies and that
  45. X * both that copyright notice and this permission notice appear in
  46. X * supporting documentation, and that the name of Digital Equipment
  47. X * Corporation not be used in advertising or publicity pertaining to
  48. X * distribution of the software without specific, written prior permission.
  49. X *
  50. X *
  51. X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  52. X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  53. X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  54. X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  55. X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  56. X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  57. X * SOFTWARE.
  58. X */
  59. X
  60. X/* ptyx.h */
  61. X/* @(#)ptyx.h    X10/6.6    11/10/86 */
  62. X
  63. X#include <X11/Xos.h>
  64. X#include <X11/Xlib.h>
  65. X#include <X11/IntrinsicP.h>
  66. X
  67. X/* Extra Xlib definitions */
  68. X#define AllButtonsUp(detail, ignore)  (\
  69. X        ((ignore) == Button1) ? \
  70. X                (((detail)&(Button2Mask|Button3Mask)) == 0) \
  71. X                : \
  72. X         (((ignore) == Button2) ? \
  73. X                  (((detail)&(Button1Mask|Button3Mask)) == 0) \
  74. X                : \
  75. X                  (((detail)&(Button1Mask|Button2Mask)) == 0)) \
  76. X        )
  77. X
  78. X
  79. X#define Max(i, j)       ((i) > (j) ? (i) : (j))
  80. X#define Min(i, j)       ((i) < (j) ? (i) : (j))
  81. X
  82. X#define MAX_COLS    200
  83. X#define MAX_ROWS    128
  84. X
  85. X/*
  86. X** System V definitions
  87. X*/
  88. X
  89. X#ifdef SYSV
  90. X
  91. X#ifdef JOBCONTROL
  92. X#define    getpgrp        getpgrp2
  93. X#else    /* !JOBCONTROL */
  94. X#define    getpgrp(x)    (x)
  95. X#endif    /* !JOBCONTROL */
  96. X
  97. X#define    killpg(x,sig)    kill(-x,sig)
  98. X
  99. X#define    dup2(fd1,fd2)    ((fd1 == fd2) ? fd1 : \
  100. X                (close(fd2), fcntl(fd1, F_DUPFD, fd2)))
  101. X
  102. X#endif    /* !SYSV */
  103. X
  104. X/*
  105. X** allow for mobility of the pty master/slave directories
  106. X*/
  107. X#ifndef PTYDEV
  108. X#ifdef hpux
  109. X#define    PTYDEV        "/dev/ptym/ptyxx"
  110. X#else    /* !hpux */
  111. X#define    PTYDEV        "/dev/ptyxx"
  112. X#endif    /* !hpux */
  113. X#endif    /* !PTYDEV */
  114. X
  115. X#ifndef TTYDEV
  116. X#ifdef hpux
  117. X#define TTYDEV        "/dev/pty/ttyxx"
  118. X#else    /* !hpux */
  119. X#define    TTYDEV        "/dev/ttyxx"
  120. X#endif    /* !hpux */
  121. X#endif    /* !TTYDEV */
  122. X
  123. X#ifndef PTYCHAR1
  124. X#ifdef hpux
  125. X#define PTYCHAR1    "zyxwvutsrqp"
  126. X#else    /* !hpux */
  127. X#define    PTYCHAR1    "pqrstuvwxyz"
  128. X#endif    /* !hpux */
  129. X#endif    /* !PTYCHAR1 */
  130. X
  131. X#ifndef PTYCHAR2
  132. X#ifdef hpux
  133. X#define    PTYCHAR2    "fedcba9876543210"
  134. X#else    /* !hpux */
  135. X#define    PTYCHAR2    "0123456789abcdef"
  136. X#endif    /* !hpux */
  137. X#endif    /* !PTYCHAR2 */
  138. X
  139. X/* Until the translation manager comes along, I have to do my own translation of
  140. X * mouse events into the proper routines. */
  141. X
  142. Xtypedef enum {NORMAL, LEFTEXTENSION, RIGHTEXTENSION} EventMode;
  143. X
  144. X/*
  145. X * The origin of a screen is 0, 0.  Therefore, the number of rows
  146. X * on a screen is screen->max_row + 1, and similarly for columns.
  147. X */
  148. X
  149. Xtypedef char **ScrnBuf;
  150. X
  151. X/*
  152. X * ANSI emulation.
  153. X */
  154. X#define INQ    0x05
  155. X#define    FF    0x0C            /* C0, C1 control names        */
  156. X#define    LS1    0x0E
  157. X#define    LS0    0x0F
  158. X#define    CAN    0x18
  159. X#define    SUB    0x1A
  160. X#define    ESC    0x1B
  161. X#define US    0x1F
  162. X#define    DEL    0x7F
  163. X#define HTS     ('H'+0x40)
  164. X#define    SS2    0x8E
  165. X#define    SS3    0x8F
  166. X#define    DCS    0x90
  167. X#define    OLDID    0x9A            /* ESC Z            */
  168. X#define    CSI    0x9B
  169. X#define    ST    0x9C
  170. X#define    OSC    0x9D
  171. X#define    PM    0x9E
  172. X#define    APC    0x9F
  173. X#define    RDEL    0xFF
  174. X
  175. X#define    NBOX    5            /* Number of Points in box    */
  176. X#define    NPARAM    10            /* Max. parameters        */
  177. X
  178. X#define    MINHILITE    32
  179. X
  180. Xtypedef struct {
  181. X    unsigned char    a_type;
  182. X    unsigned char    a_pintro;
  183. X    unsigned char    a_final;
  184. X    unsigned char    a_inters;
  185. X    char    a_nparam;        /* # of parameters        */
  186. X    char    a_dflt[NPARAM];        /* Default value flags        */
  187. X    short    a_param[NPARAM];    /* Parameters            */
  188. X    char    a_nastyf;        /* Error flag            */
  189. X} ANSI;
  190. X
  191. Xtypedef struct {
  192. X    int        row;
  193. X    int        col;
  194. X    unsigned    flags;    /* Vt100 saves graphics rendition. Ugh! */
  195. X    char        curgl;
  196. X    char        curgr;
  197. X    char        gsets[4];
  198. X} SavedCursor;
  199. X
  200. X#define    TEKNUMFONTS    4
  201. X/* Actually there are 5 types of lines, but four are non-solid lines */
  202. X#define    TEKNUMLINES    4
  203. X
  204. Xtypedef struct {
  205. X    int    x;
  206. X    int    y;
  207. X    int    fontsize;
  208. X    int    linetype;
  209. X} Tmodes;
  210. X
  211. Xtypedef struct {
  212. X    int Twidth;
  213. X    int Theight;
  214. X} T_fontsize;
  215. X
  216. Xtypedef struct {
  217. X    short *bits;
  218. X    int x;
  219. X    int y;
  220. X    int width;
  221. X    int height;
  222. X} BitmapBits;
  223. X
  224. X#define    SAVELINES        64      /* default # lines to save      */
  225. X
  226. Xtypedef struct {
  227. X/* These parameters apply to both windows */
  228. X    Display        *display;    /* X display for screen        */
  229. X    int        respond;    /* socket for responses
  230. X                       (position report, etc.)    */
  231. X    long        pid;        /* pid of process on far side   */
  232. X    int        uid;        /* user id of actual person    */
  233. X    int        gid;        /* group id of actual person    */
  234. X    GC        normalGC;    /* normal painting        */
  235. X    GC        reverseGC;    /* reverse painting        */
  236. X    GC        normalboldGC;    /* normal painting, bold font    */
  237. X    GC        reverseboldGC;    /* reverse painting, bold font    */
  238. X    GC        cursorGC;    /* normal cursor painting    */
  239. X    GC        reversecursorGC;/* reverse cursor painting    */
  240. X    GC        cursoroutlineGC;/* for painting lines around    */
  241. X    Pixel        foreground;    /* foreground color        */
  242. X    Pixel        cursorcolor;    /* Cursor color            */
  243. X    Pixel        mousecolor;    /* Mouse color            */
  244. X    int        border;        /* inner border            */
  245. X    Pixmap        graybordertile;    /* tile pixmap for border when
  246. X                        window is unselected    */
  247. X    Cursor        arrow;        /* arrow cursor            */
  248. X    unsigned short    send_mouse_pos;    /* user wants mouse transition  */
  249. X                    /* and position information    */
  250. X    int        select;        /* xterm selected        */
  251. X    Boolean        visualbell;    /* visual bell mode        */
  252. X    int        logging;    /* logging mode            */
  253. X    int        logfd;        /* file descriptor of log    */
  254. X    char        *logfile;    /* log file name        */
  255. X    char        *logstart;    /* current start of log buffer    */
  256. X    int        inhibit;    /* flags for inhibiting changes    */
  257. X
  258. X/* VT window parameters */
  259. X    struct {
  260. X        Window    window;        /* X window id            */
  261. X        int    width;        /* width of columns        */
  262. X        int    height;        /* height of rows        */
  263. X        int    fullwidth;    /* full width of window        */
  264. X        int    fullheight;    /* full height of window    */
  265. X        int    f_width;    /* width of fonts in pixels    */
  266. X        int    f_height;    /* height of fonts in pixels    */
  267. X    } fullVwin;
  268. X    Cursor pointer_cursor;        /* pointer cursor in window    */
  269. X
  270. X    /* Terminal fonts must be of the same size and of fixed width */
  271. X    XFontStruct    *fnt_norm;    /* normal font of terminal    */
  272. X    XFontStruct    *fnt_bold;    /* bold font of terminal    */
  273. X    int        enbolden;    /* overstrike for bold font    */
  274. X    XPoint        *box;        /* draw unselected cursor    */
  275. X
  276. X    int        cursor_state;    /* ON or OFF            */
  277. X    int        cursor_set;    /* requested state        */
  278. X    int        cursor_col;    /* previous cursor column    */
  279. X    int        cursor_row;    /* previous cursor row        */
  280. X    int        cur_col;    /* current cursor column    */
  281. X    int        cur_row;    /* current cursor row        */
  282. X    int        max_col;    /* rightmost column        */
  283. X    int        max_row;    /* bottom row            */
  284. X    int        top_marg;    /* top line of scrolling region */
  285. X    int        bot_marg;    /* bottom line of  "        "    */
  286. X    Widget        scrollWidget;    /* pointer to scrollbar struct    */
  287. X    int        scrollbar;    /* if > 0, width of scrollbar, and
  288. X                        scrollbar is showing    */
  289. X    int        topline;    /* line number of top, <= 0    */
  290. X    int        savedlines;     /* number of lines that've been saved */
  291. X    int        savelines;    /* number of lines off top to save */
  292. X    Boolean        scrollinput;    /* scroll to bottom on input    */
  293. X    Boolean        scrollkey;    /* scroll to bottom on key    */
  294. X    
  295. X    ScrnBuf        buf;        /* screen buffer (main)        */
  296. X    ScrnBuf        allbuf;        /* screen buffer (may include
  297. X                       lines scrolled off top    */
  298. X    ScrnBuf        altbuf;        /* alternate screen buffer    */
  299. X    Boolean        alternate;    /* true if using alternate buf    */
  300. X    unsigned short    do_wrap;    /* true if cursor in last column
  301. X                       and character just output    */
  302. X    int        incopy;        /* 0 if no RasterCopy exposure
  303. X                       event processed since last
  304. X                       RasterCopy            */
  305. X    Boolean        c132;        /* allow change to 132 columns    */
  306. X    Boolean        curses;        /* cludge-ups for more and vi    */
  307. X    Boolean        marginbell;    /* true if margin bell on    */
  308. X    int        nmarginbell;    /* columns from right margin    */
  309. X    int        bellarmed;    /* cursor below bell margin    */
  310. X    Boolean     multiscroll;    /* true if multi-scroll        */
  311. X    int        scrolls;    /* outstanding scroll count    */
  312. X    SavedCursor    sc;        /* data for restore cursor    */
  313. X    int        save_modes[19];    /* save dec private modes    */
  314. X
  315. X    /* Improved VT100 emulation stuff.                */
  316. X    char        gsets[4];    /* G0 through G3.        */
  317. X    char        curgl;        /* Current GL setting.        */
  318. X    char        curgr;        /* Current GR setting.        */
  319. X    char        curss;        /* Current single shift.    */
  320. X    int        scroll_amt;    /* amount to scroll        */
  321. X    int        refresh_amt;    /* amount to refresh        */
  322. X    Boolean        jumpscroll;    /* whether we should jumpscroll */
  323. X    Boolean         always_highlight; /* whether to highlight cursor */
  324. X
  325. X/* Tektronix window parameters */
  326. X    GC        TnormalGC;    /* normal painting        */
  327. X    GC        TcursorGC;    /* normal cursor painting    */
  328. X    Pixel        Tforeground;    /* foreground color        */
  329. X    Pixel        Tbackground;    /* Background color        */
  330. X    Pixel        Tcursorcolor;    /* Cursor color            */
  331. X    Pixmap        Tbgndtile;    /* background tile pixmap    */
  332. X    int        Tcolor;        /* colors used            */
  333. X    Boolean        planeused;    /* is xorplane being used    */
  334. X    Boolean        cellsused;    /* are color cells being used    */
  335. X    XColor        colorcells[3];    /* color cells for Tek        */
  336. X    Boolean        Vshow;        /* VT window showing        */
  337. X    Boolean        Tshow;        /* Tek window showing        */
  338. X    Boolean        waitrefresh;    /* postpone refresh        */
  339. X    struct {
  340. X        Window    window;        /* X window id            */
  341. X        int    width;        /* width of columns        */
  342. X        int    height;        /* height of rows        */
  343. X        int    fullwidth;    /* full width of window        */
  344. X        int    fullheight;    /* full height of window    */
  345. X        double    tekscale;    /* scale factor Tek -> vs100    */
  346. X    } fullTwin;
  347. X    XPoint        **Tbox;        /* draw unselected cursor    */
  348. X    int        xorplane;    /* z plane for inverts        */
  349. X    GC        linepat[TEKNUMLINES]; /* line patterns        */
  350. X    XFontStruct     *Tfont[TEKNUMFONTS]; /* Tek fonts        */
  351. X    int        tobaseline[TEKNUMFONTS]; /* top to baseline for
  352. X                            each font    */
  353. X    Boolean        TekEmu;        /* true if Tektronix emulation    */
  354. X    int        cur_X;        /* current x            */
  355. X    int        cur_Y;        /* current y            */
  356. X    Tmodes        cur;        /* current tek modes        */
  357. X    Tmodes        page;        /* starting tek modes on page    */
  358. X    int        margin;        /* 0 -> margin 1, 1 -> margin 2    */
  359. X    int        pen;        /* current Tektronix pen 0=up, 1=dn */
  360. X    char        *TekGIN;    /* nonzero if Tektronix GIN mode*/
  361. X    int        multiClickTime;     /* time between multiclick selects */
  362. X    char        *charClass;    /* for overriding word selection */
  363. X    Boolean        cutNewline;    /* whether or not line cut has \n */
  364. X    Boolean        cutToBeginningOfLine;  /* line cuts to BOL? */
  365. X    char        *selection;    /* the current selection */
  366. X    int        selection_size; /* size of allocated buffer */
  367. X    int        selection_length; /* number of significant bytes */
  368. X    int        selection_time;    /* latest event timestamp */
  369. X    int        startHRow, startHCol, /* highlighted text */
  370. X            endHRow, endHCol,
  371. X            startHCoord, endHCoord;
  372. X    Atom*        selection_atoms; /* which selections we own */
  373. X    Cardinal    sel_atoms_size;    /*  how many atoms allocated */
  374. X    Cardinal    selection_count; /* how many atoms in use */
  375. X} TScreen;
  376. X
  377. X/* meaning of bits in screen.select flag */
  378. X#define    INWINDOW    01    /* the mouse is in one of the windows */
  379. X#define    FOCUS        02    /* one of the windows is the focus window */
  380. X
  381. X#define MULTICLICKTIME 250    /* milliseconds */
  382. X
  383. Xtypedef struct
  384. X{
  385. X    unsigned    flags;
  386. X} TKeyboard;
  387. X
  388. Xtypedef struct _Misc {
  389. X    char *geo_metry;
  390. X    char *T_geometry;
  391. X    char *f_n;
  392. X    char *f_b;
  393. X    Boolean log_on;
  394. X    Boolean login_shell;
  395. X    Boolean re_verse;
  396. X    Boolean reverseWrap;
  397. X    Boolean logInhibit;
  398. X    Boolean signalInhibit;
  399. X    Boolean tekInhibit;
  400. X    Boolean scrollbar;
  401. X    Boolean titeInhibit;
  402. X} Misc;
  403. X
  404. Xtypedef struct {int foo;} XtermClassPart, TekClassPart;
  405. X
  406. Xtypedef struct _XtermClassRec {
  407. X    CoreClassPart  core_class;
  408. X    XtermClassPart xterm_class;
  409. X} XtermClassRec;
  410. X
  411. Xtypedef struct _TekClassRec {
  412. X    CoreClassPart core_class;
  413. X    TekClassPart tek_class;
  414. X} TekClassRec;
  415. X
  416. X/* define masks for flags */
  417. X#define CAPS_LOCK    0x01
  418. X#define KYPD_APL    0x02
  419. X#define CURSOR_APL    0x04
  420. X
  421. X
  422. X#define N_MARGINBELL    10
  423. X#define MAX_TABS    320
  424. X#define TAB_ARRAY_SIZE    10    /* number of ints to provide MAX_TABS bits */
  425. X
  426. Xtypedef unsigned Tabs [TAB_ARRAY_SIZE];
  427. X
  428. Xtypedef struct _XtermWidgetRec {
  429. X    CorePart    core;
  430. X    TKeyboard    keyboard;    /* terminal keyboard        */
  431. X    TScreen    screen;        /* terminal screen        */
  432. X    unsigned    flags;        /* mode flags            */
  433. X    unsigned    initflags;    /* initial mode flags        */
  434. X    Tabs    tabs;        /* tabstops of the terminal    */
  435. X    Misc    misc;        /* miscelaneous parameters    */
  436. X} XtermWidgetRec, *XtermWidget;
  437. X
  438. Xtypedef struct _TekWidgetRec {
  439. X    CorePart core;
  440. X} TekWidgetRec, *TekWidget;
  441. X
  442. X#define BUF_SIZE 4096
  443. X
  444. X/* masks for terminal flags */
  445. X
  446. X#define INVERSE        0x01    /* invert the characters to be output */
  447. X#define UNDERLINE    0x02    /* true if underlining */
  448. X#define BOLD        0x04
  449. X#define WRAPAROUND    0x08
  450. X#define REVERSE_VIDEO    0x10    /* true if screen white on black */
  451. X#define ORIGIN        0x20    /* true if in origin mode */
  452. X#define INSERT        0x40    /* true if in insert mode */
  453. X#define SMOOTHSCROLL    0x80    /* true if in smooth scroll mode */
  454. X#ifdef DO_AUTOREPEAT
  455. X#define AUTOREPEAT    0x100    /* true if in autorepeat mode */
  456. X#endif /* DO_AUTOREPEAT */
  457. X#define IN132COLUMNS    0x200    /* true if in 132 column mode */
  458. X#define LINEFEED    0x400
  459. X#define    REVERSEWRAP    0x800    /* true if reverse wraparound mode */
  460. X
  461. X#define    ATTRIBUTES    0x07    /* attributes mask */
  462. X#define CHAR        0177
  463. X
  464. X#define VWindow(screen)        (screen->fullVwin.window)
  465. X#define VShellWindow        term->core.parent->core.window
  466. X#define TextWindow(screen)      (screen->fullVwin.window)
  467. X#define TWindow(screen)        (screen->fullTwin.window)
  468. X#define TShellWindow        tekWidget->core.parent->core.window
  469. X#define Width(screen)        (screen->fullVwin.width)
  470. X#define Height(screen)        (screen->fullVwin.height)
  471. X#define FullWidth(screen)    (screen->fullVwin.fullwidth)
  472. X#define FullHeight(screen)    (screen->fullVwin.fullheight)
  473. X#define FontWidth(screen)    (screen->fullVwin.f_width)
  474. X#define FontHeight(screen)    (screen->fullVwin.f_height)
  475. X#define TWidth(screen)        (screen->fullTwin.width)
  476. X#define THeight(screen)        (screen->fullTwin.height)
  477. X#define TFullWidth(screen)    (screen->fullTwin.fullwidth)
  478. X#define TFullHeight(screen)    (screen->fullTwin.fullheight)
  479. X#define TekScale(screen)    (screen->fullTwin.tekscale)
  480. X
  481. X#define CursorX(screen,col) ((col) * FontWidth(screen) + screen->border \
  482. X            + screen->scrollbar)
  483. X#define CursorY(screen,row) ((((row) - screen->topline) * FontHeight(screen)) \
  484. X            + screen->border)
  485. X
  486. X#define    TWINDOWEVENTS    (KeyPressMask | ExposureMask | ButtonPressMask |\
  487. X             ButtonReleaseMask | StructureNotifyMask |\
  488. X             EnterWindowMask | LeaveWindowMask | FocusChangeMask)
  489. X
  490. X#define    WINDOWEVENTS    (TWINDOWEVENTS | PointerMotionMask)
  491. X
  492. X
  493. X#define TEK_LINK_BLOCK_SIZE 1024
  494. X
  495. Xtypedef struct Tek_Link
  496. X{
  497. X    struct Tek_Link    *next;    /* pointer to next TekLink in list
  498. X                   NULL <=> this is last TekLink */
  499. X    short count;
  500. X    char *ptr;
  501. X    char data [TEK_LINK_BLOCK_SIZE];
  502. X} TekLink;
  503. X
  504. X/* flags for cursors */
  505. X#define    OFF        0
  506. X#define    ON        1
  507. X#define    CLEAR        0
  508. X#define    TOGGLE        1
  509. X
  510. X/* flags for inhibit */
  511. X#define    I_LOG        0x01
  512. X#define    I_SIGNAL    0x02
  513. X#define    I_TEK        0x04
  514. X
  515. Xextern Cursor make_tcross();
  516. Xextern Cursor make_xterm();
  517. Xextern Cursor make_wait();
  518. Xextern Cursor make_arrow();
  519. END_OF_FILE
  520. if test 15008 -ne `wc -c <'ptyx.h'`; then
  521.     echo shar: \"'ptyx.h'\" unpacked with wrong size!
  522. fi
  523. # end of 'ptyx.h'
  524. fi
  525. if test -f 'xroutines.c' -a "${1}" != "-c" ; then 
  526.   echo shar: Will not clobber existing file \"'xroutines.c'\"
  527. else
  528. echo shar: Extracting \"'xroutines.c'\" \(2773 characters\)
  529. sed "s/^X//" >'xroutines.c' <<'END_OF_FILE'
  530. X#include "xdmconsole.h"
  531. X
  532. XDisplay   *disp;
  533. XWindow     win;
  534. XGC         wingc;
  535. XXFontStruct        *font;
  536. XXEvent     thebigevent;
  537. XXSizeHints hinthint;
  538. XCursor     wincurs, opwincurs;
  539. Xint        screen;
  540. Xlong       foreg, backg;
  541. Xint       winw, winh;
  542. X
  543. X
  544. Xint initwin(width, height, x, y, border, trans, name)
  545. Xint width, height, x, y, border, trans;
  546. Xchar *name;
  547. X{
  548. X
  549. X    if (win > 0) return(-1);
  550. X
  551. X    if ((disp = XOpenDisplay("unix:0.0")) == NULL) exit(0);
  552. X    screen=DefaultScreen(disp);
  553. X
  554. X    if (x < 0) x = (int) ((DisplayWidth(disp, screen) - width) /2);
  555. X    if (y < 0) y = (int) (DisplayHeight(disp, screen) - (height + 30));
  556. X
  557. X        backg=WhitePixel(disp, screen);
  558. X        foreg=BlackPixel(disp, screen);
  559. X
  560. X    win=XCreateSimpleWindow(disp, DefaultRootWindow(disp),
  561. X                x, y, width, height, 
  562. X                border, foreg, backg);
  563. X
  564. X        wingc=XCreateGC(disp, win, 0, 0);
  565. X        XSetBackground(disp, wingc, backg);
  566. X        XSetForeground(disp, wingc, foreg);
  567. X
  568. X        XStoreName(disp, win, name);
  569. X
  570. X    if (trans) XSetTransientForHint(disp, win, win);
  571. X    winh=height;
  572. X    winw=width;
  573. X}
  574. X
  575. Xint winfont(fontname)
  576. Xchar *fontname;
  577. X{
  578. X    int ndirs;
  579. X    char **dir;
  580. X
  581. X    dir = XGetFontPath(disp, &ndirs);
  582. X    dir[ndirs] = (char *) malloc(sizeof("/usr/lib/X11/fonts/75dpi")+2);
  583. X    strcpy(dir[ndirs++], "/usr/lib/X11/fonts/75dpi");
  584. X    XSetFontPath(disp, dir, ndirs);
  585. X    font=XLoadQueryFont(disp, fontname);
  586. X        XSetFont(disp, wingc, font->fid);
  587. X    XFreeFontPath(dir);
  588. X}
  589. X
  590. Xint wincursor(cursor)
  591. Xchar *cursor;
  592. X{
  593. X        wincurs=XCreateFontCursor(disp, XC_gumby);
  594. X        XDefineCursor(disp, win, wincurs);
  595. X}
  596. X
  597. Xint winevents(event) 
  598. Xlong event;
  599. X{
  600. X    XSelectInput(disp, win, event);
  601. X}
  602. X
  603. X
  604. Xint winprint(x, y, string)
  605. Xint x, y;
  606. Xchar *string;
  607. X{
  608. X    XDrawString(disp, win, wingc, x, y, string, strlen(string));
  609. X    XFlush(disp);
  610. X}
  611. X
  612. Xint winwrapprint(x, y, string, inc)
  613. Xint x, y;
  614. Xchar *string;
  615. Xint inc;
  616. X{
  617. X    int count=0;
  618. X    if (XTextWidth(font, string, strlen(string)) > winw)
  619. X    {
  620. X        for (count=strlen(string); XTextWidth(font, string, count) > winw; count--);
  621. X        XDrawString(disp, win, wingc, x, y, string, count);
  622. X        scrollup(inc);
  623. X        XDrawString(disp, win, wingc, x, y, &string[count+1], strlen(&string[count+1]));
  624. X        XFlush(disp);
  625. X        return(1);
  626. X    }
  627. X    XDrawString(disp, win, wingc, x, y, string, strlen(string));
  628. X    XFlush(disp);
  629. X    return(0);
  630. X}
  631. X
  632. Xint showwin()
  633. X{
  634. X    XMapRaised(disp, win);
  635. X    XFlush(disp);
  636. X    XNextEvent(disp, &thebigevent);
  637. X}
  638. X
  639. Xint clearwin()
  640. X{
  641. X    XClearWindow(disp, win);
  642. X}
  643. X
  644. Xint scrollup(lineheight)
  645. Xint lineheight;
  646. X{
  647. X    int     x, y, height, width;
  648. X
  649. X    x=0;
  650. X    y=lineheight;
  651. X    width=winw;
  652. X    height=winh-lineheight;
  653. X    XCopyArea(disp, win, win, wingc, x, y, width, height, 0, 0);
  654. X    XClearArea(disp, win, 0, height, width, lineheight, False);
  655. X    XFlush(disp);
  656. X}
  657. X
  658. Xint windeath()
  659. X{
  660. X    XFreeFont(disp, font);
  661. X    XFreeGC(disp, wingc);
  662. X    XDestroyWindow(disp, win);
  663. X    win = 0;
  664. X    XCloseDisplay(disp);
  665. X}
  666. END_OF_FILE
  667. if test 2773 -ne `wc -c <'xroutines.c'`; then
  668.     echo shar: \"'xroutines.c'\" unpacked with wrong size!
  669. fi
  670. # end of 'xroutines.c'
  671. fi
  672. echo shar: End of shell archive.
  673. exit 0
  674.  
  675. dan
  676. ----------------------------------------------------
  677. O'Reilly && Associates   argv@sun.com / argv@ora.com
  678. Opinions expressed reflect those of the author only.
  679.